package org.zw.zcommon.zcdate;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * TODO
 *
 * @author singleton-zw
 * @date 2025/10/2 14:25
 */
public class ZCDate {
    public static long getTimeStamp(String dateStr) {
        SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        try {
            Date date = formatter1.parse(dateStr);
            long timestamp1 = date.getTime(); // 转换为毫秒时间戳
            // 如果需要秒级别的时间戳，可以除以1000
//            long timestampInSeconds = timestamp1 / 1000;
            return timestamp1;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }
}
